.TH std::basic_ios::imbue 3 "2024.06.10" "http://cppreference.com" "C++ Standard Libary"
.SH NAME
std::basic_ios::imbue \- std::basic_ios::imbue

.SH Synopsis
   std::locale imbue( const std::locale& loc );

   Replaces the current locale. Effectively calls ios_base::imbue(loc) and if there is
   an associated stream buffer (rdbuf() != 0), then calls rdbuf()->pubimbue(loc).

.SH Parameters

   loc - the new locale

.SH Return value

   The previous locale, as returned by ios_base::imbue(loc).

.SH Exceptions

   May throw implementation-defined exceptions.

.SH Example


// Run this code

 #include <iostream>
 #include <locale>
 #include <sstream>

 int main()
 {
     std::istringstream iss;
     iss.imbue(std::locale("en_US.UTF8"));

     std::cout << "Current locale: " << iss.getloc().name() << '\\n';

     iss.imbue(std::locale());
     std::cout << "Global locale : " << iss.getloc().name() << '\\n';
 }

.SH Output:

 Current locale: en_US.UTF8
 Global locale : C
